import { ActionBase } from "../../ActionBase";

/**
 * 放置site Action
 */
export class ActionTowerHeal  extends ActionBase<IActionCMD<"towerHeal">>
{
    public execute(action: IActionCMD<"towerHeal">): ActionCode 
    {
        const room = action.arg.entity as Required<Room>;
        const towers = room.towers();
        const targets = action.arg.task.data.arg.Creeps;
        while(towers.length>0 && targets.length>0)
        {
            const top = towers.pop() as StructureTower;
            let creep = Game.creeps[targets.pop() as string];
            top.heal(creep);
        }
        return 0;
    }
}